#include <iostream>
#include <unordered_map>
#include <string>
#include <gtest/gtest.h>
using namespace std;

class MyTestSuite1 : public testing::Test
{
public:
    static void SetUpTestCase()
    {
        cout << "MyTestSuite1 测试套件开始初始化" << endl;
    }

    static void TearDownTestCase()
    {
        cout << "MyTestSuite1 测试套件清除数据" << endl;
    }

public:
    std::unordered_map<std::string, std::string> dict;
};

class MyTestSuite2 : public testing::Test
{
public:
    static void SetUpTestCase()
    {
        cout << "MyTestSuite2 测试套件开始初始化" << endl;
    }

    static void TearDownTestCase()
    {
        cout << "MyTestSuite2 测试套件清除数据" << endl;
    }

public:
    std::unordered_map<std::string, std::string> dict;
};

TEST_F(MyTestSuite1, test_suite1)
{
    cout << "开始 test_suite1 第一次测试" << endl;
    dict["hello"] = "你好";
    dict["thanks"] = "谢谢";
    dict["pen"] = "笔";
    auto it = dict.find("hello");
    ASSERT_NE(it, dict.end());
}

TEST_F(MyTestSuite1, test_suite2)
{
    cout << "开始 test_suite1 第二次测试" << endl;
    cout << "hash的大小: " << dict.size() << endl;
    ASSERT_EQ(dict.size(), 3);
}

TEST_F(MyTestSuite2, test_suite1)
{
    cout << "开始 test_suite1 第一次测试" << endl;
    dict["hello"] = "你好";
    dict["thanks"] = "谢谢";
    dict["pen"] = "笔";
    auto it = dict.find("hello");
    ASSERT_NE(it, dict.end());
}

TEST_F(MyTestSuite2, test_suite2)
{
    cout << "开始 test_suite1 第二次测试" << endl;
    cout << "hash的大小: " << dict.size() << endl;
    ASSERT_EQ(dict.size(), 3);
}

int main(int argc, char *argv[])
{
    testing::InitGoogleTest(&argc, argv);
    return RUN_ALL_TESTS();
}